require 'socket'
require 'timeout'

def port_status(website, port)

	begin
		Timeout::timeout(10) do
			begin
				s = TCPSocket.new(website, port)
				s.close
				return true
			rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
				return false
			end
		end
	rescue Timeout::Error
	end

	return false
end